/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "RESERVA", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Reserva.findAll", query = "SELECT r FROM Reserva r"),
    @NamedQuery(name = "Reserva.findByCodigoreserva", query = "SELECT r FROM Reserva r WHERE r.codigoreserva = :codigoreserva"),
    @NamedQuery(name = "Reserva.findByConceptoreserva", query = "SELECT r FROM Reserva r WHERE r.conceptoreserva = :conceptoreserva"),
    @NamedQuery(name = "Reserva.findByEstado", query = "SELECT r FROM Reserva r WHERE r.estado = :estado")})
public class Reserva implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CODIGORESERVA", nullable = false)
    private Integer codigoreserva;
    @Basic(optional = false)
    @Column(name = "CONCEPTORESERVA", nullable = false, length = 500)
    private String conceptoreserva;
    @Column(name = "ESTADO", length = 1)
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reserva", fetch = FetchType.EAGER)
    private List<Reservahotel> reservahotelList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reserva", fetch = FetchType.EAGER)
    private List<Reservarestaurante> reservarestauranteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reserva", fetch = FetchType.EAGER)
    private List<Reservatransporte> reservatransporteList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "reserva", fetch = FetchType.EAGER)
    private Reservarecurso reservarecurso;

    public Reserva() {
    }

    public Reserva(Integer codigoreserva) {
        this.codigoreserva = codigoreserva;
    }

    public Reserva(Integer codigoreserva, String conceptoreserva) {
        this.codigoreserva = codigoreserva;
        this.conceptoreserva = conceptoreserva;
    }

    public Integer getCodigoreserva() {
        return codigoreserva;
    }

    public void setCodigoreserva(Integer codigoreserva) {
        this.codigoreserva = codigoreserva;
    }

    public String getConceptoreserva() {
        return conceptoreserva;
    }

    public void setConceptoreserva(String conceptoreserva) {
        this.conceptoreserva = conceptoreserva;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public List<Reservahotel> getReservahotelList() {
        return reservahotelList;
    }

    public void setReservahotelList(List<Reservahotel> reservahotelList) {
        this.reservahotelList = reservahotelList;
    }

    public List<Reservarestaurante> getReservarestauranteList() {
        return reservarestauranteList;
    }

    public void setReservarestauranteList(List<Reservarestaurante> reservarestauranteList) {
        this.reservarestauranteList = reservarestauranteList;
    }

    public List<Reservatransporte> getReservatransporteList() {
        return reservatransporteList;
    }

    public void setReservatransporteList(List<Reservatransporte> reservatransporteList) {
        this.reservatransporteList = reservatransporteList;
    }

    public Reservarecurso getReservarecurso() {
        return reservarecurso;
    }

    public void setReservarecurso(Reservarecurso reservarecurso) {
        this.reservarecurso = reservarecurso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigoreserva != null ? codigoreserva.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reserva)) {
            return false;
        }
        Reserva other = (Reserva) object;
        if ((this.codigoreserva == null && other.codigoreserva != null) || (this.codigoreserva != null && !this.codigoreserva.equals(other.codigoreserva))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Reserva[codigoreserva=" + codigoreserva + "]";
    }

}
